﻿using System;
using System.Collections.Generic;
using System.Web.Http;
using SimpleScrum.Areas.Scrum.Models;
using SimpleScrum.Core.Entities;

namespace SimpleScrum.Areas.Scrum.Controllers.Api
{
    public class ProjectController : ApiController
    {
        // GET api/project
        public IEnumerable<string> Get()
        {
            return new[] {"value1", "value2"};
        }

        // GET api/project/5
        public IEnumerable<ProjectJson> Get(Guid id)
        {
            IList<Project> projects = new ProjectModel().GetProjects(id);
            var projectJsons = new List<ProjectJson>();
            foreach (Project project in projects)
            {
                var json = new ProjectJson
                    {
                        ID = project.Id,
                        Name = project.Name,
                        Description = project.Description
                    };
                projectJsons.Add(json);
            }
            return projectJsons;
        }

        // POST api/project
        public void Post([FromBody] string value)
        {
        }

        // PUT api/project/5
        public void Put(int id, [FromBody] string value)
        {
        }

        // DELETE api/project/5
        public void Delete(int id)
        {
        }
    }

    public class ProjectJson
    {
        public Guid ID { get; set; }
        public String Name { get; set; }
        public String Description { get; set; }
    }
}